<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>Form Validation - #073 of #100Days100Projects</title>


<link rel="stylesheet" href="css/style2.css">

</head>
<body>

<div class="container">
	<div class="header">
		<h2>添加签到时间</h2>
	</div>
	<form id="form" class="form">
		<div class="form-control">
			<label for="username">开始时间</label>
			<input type="text" placeholder="例子：19:00(5位数字符串)" id="username"  name="start" value="19:00"/>
			<i class="fas fa-check-circle"></i>
			<i class="fas fa-exclamation-circle"></i>
			<small>Error message</small>
		</div>
		<div class="form-control">
			<label for="username">结束时间</label>
			<input type="username" placeholder="例子：19:00(5位数字符串)" id="password" name="stop" value="20:00"/>
			<i class="fas fa-check-circle"></i>
			<i class="fas fa-exclamation-circle"></i>
			<small>Error message</small>
		</div>
		<button onclick="add()">提交</button>
	</form>
</div>
<script type="text/javascript" src="./script/api.js"></script>
<script src="js/jquery.js"></script>
<script type="text/javascript">

  function add(){
        var userName = $api.val($api.byId('username')),
                password = $api.val($api.byId('password'));
					console.log(userName+password)
        if(!userName||!password){
              return;
        }else{
						$.get('http://192.168.0.100:8081/face/add_time2.do?start='+userName+'&stop='+ password,function(data,status){
						 });
						 alert("添加成功");
						 api.openWin({
							 name: 'login',
							 url: './index.html',
							 pageParam: {
									 name: 'login'
							 }
				 });
        }
    }

</script>
</body>
</html>
